package com.gexiaobao.pigeon.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.AppRaceOrderList
import com.gexiaobao.pigeon.databinding.ItemPassSignOrderBinding

/**
 * @Author      : hxw
 * @Date        : 2024/7/18 10:56
 * @Describe    :
 */
class AdapterPassSignOrder(data: ArrayList<AppRaceOrderList>) :
    BaseQuickAdapter<AppRaceOrderList, DataBindBaseViewHolder>(R.layout.item_pass_sign_order, data) {
    override fun convert(holder: DataBindBaseViewHolder, item: AppRaceOrderList) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemPassSignOrderBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        val proof: String
        val isGone: Boolean
        if (item.uploadFiles.isEmpty()) {
            proof = context.getString(R.string.have_not_uploaded)
            isGone = false
        } else {
            proof = context.getString(R.string.have_already_uploaded)//"已上传"
            isGone = true
        }
        holder.setText(R.id.tvItemPassSignProofType, context.getString(R.string.voucher) + proof)
        holder.setGone(R.id.tvItemPassSignSubmitProof, isGone)

        val signNumber = if (item.list.isNullOrEmpty()) {
            "--"
        } else {
            item.list.size.toString()
        }
        holder.setText(R.id.tvItemPigeonCount, context.getString(R.string.sign_up) + ":  " + signNumber + context.getString(R.string.yu))
    }
}